#include "home_server.h"
#include "brpc.h"
#include <brpc/naming_service.h>
#include <gflags/gflags.h>


// service start port
DEFINE_int32(start_port, 38084, "start port");
//es 
DEFINE_string(elasticsearch_host, "localhost:9200", "es的host");
//brpc 
DEFINE_string(value,"127.0.0.1:38082","value of register file_storage to etcd");
//etcd
DEFINE_string(etcd_host, "127.0.0.1:2379", "etcd addr");


int main(){
    lyt::EtcdNamingService name_server;
    brpc::NamingServiceExtension()->RegisterOrDie("etcd", &name_server);
    
    lyt::HomeServer::ptr server =lyt::HomeServerBuild()
        .make_elasticsearch_client({FLAGS_elasticsearch_host})
        .make_home_service()
        .make_brpc_server(FLAGS_start_port)
        .make_register(FLAGS_etcd_host,FLAGS_value)
        .build();
    return 0;
}